//
//  UIImageOperationView.m
//  Dayou
//
//  Created by mac on 2018/8/1.
//  Copyright © 2018年 YangYang. All rights reserved.
//

#import "UIImageOperationView.h"

@implementation UIImageOperationView
-(id)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        self.userInteractionEnabled = YES;
        
        UIButton *deleteAction = [UIButton buttonWithType:UIButtonTypeContactAdd];
        [self addSubview:deleteAction];
        [deleteAction makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.top).offset(10);
            make.right.equalTo(self.right).offset(-10);
            make.width.equalTo(30);
            make.height.equalTo(30);
        }];
        [deleteAction addTarget:self action:@selector(deletePictureAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}

-(void)setBlock:(deletePictureBlock)block
{
    _block = block;
}

-(void)deletePictureAction
{
    if (_block) {
        self.block();
    }
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
